﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO.Ports;
using System.Threading;

namespace Szakdolgozat.Screens
{
    /// <summary>
    /// Interaction logic for SelfCheck.xaml
    /// </summary>
    public partial class SelfCheckView : UserControl
    {
        MainWindow mainWindow;
        SerialPort serialport = new SerialPort();
        Command command = new Command();
        string port;

        public SelfCheckView(MainWindow mainWindow)
        {
            this.mainWindow = mainWindow;
            InitializeComponent();
        }


        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            port = command.Portselect();
            if (port == "none")
            {
                this.errortextbl.Text = "Please insert a measure head!";
                this.errortextbl.Visibility = Visibility.Visible;
            }
            else if (port == "onlyone")
            {
                this.errortextbl.Text = "Please insert only one measure head!";
                this.errortextbl.Visibility = Visibility.Visible;
            }
            else
            {
               mainWindow.contentControl1.Content = new LoginView(mainWindow);
            }

            Console.WriteLine(port);
        }
    }
}
